/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package etherblocks.engine;

import etherblocks.game.blocks.*;
import com.cubes.*;

/**
 *
 * @author Carl
 */
public class CubesConfiguration{
    
    public static CubesSettings getSettings(MainApplication mainApplication){
        CubesSettings cubesSettings = new CubesSettings(mainApplication);
        cubesSettings.setBlockSize(2);
        return cubesSettings;
    }
    
    public static void registerBlocks(){
        BlockManager.register(Block_Grass.class, new BlockSkin(new BlockSkin_TextureLocation[]{
            new BlockSkin_TextureLocation(0, 0),
            new BlockSkin_TextureLocation(1, 0),
            new BlockSkin_TextureLocation(2, 0),
        }, false){

            @Override
            protected int getTextureLocationIndex(BlockChunkControl chunk, Vector3Int blockLocation, Block.Face face){
                if(chunk.isBlockOnSurface(blockLocation)){
                    switch(face){
                        case Top:
                            return 0;

                        case Bottom:
                            return 2;
                    }
                    return 1;
                }
                return 2;
            }
        });
        BlockManager.register(Block_Trunk.class, new BlockSkin(new BlockSkin_TextureLocation[]{
            new BlockSkin_TextureLocation(4, 0),
            new BlockSkin_TextureLocation(4, 0),
            new BlockSkin_TextureLocation(3, 0),
            new BlockSkin_TextureLocation(3, 0),
            new BlockSkin_TextureLocation(3, 0),
            new BlockSkin_TextureLocation(3, 0)
        }, false));
        BlockManager.register(Block_Wood.class, new BlockSkin(new BlockSkin_TextureLocation(5, 0), false));
        BlockManager.register(Block_Rock.class, new BlockSkin(new BlockSkin_TextureLocation(6, 0), false));
        BlockManager.register(Block_Brick.class, new BlockSkin(new BlockSkin_TextureLocation(7, 0), false));
        BlockManager.register(Block_Snow.class, new BlockSkin(new BlockSkin_TextureLocation[]{
            new BlockSkin_TextureLocation(0, 1),
            new BlockSkin_TextureLocation(1, 1),
            new BlockSkin_TextureLocation(2, 0),
        }, false){

            @Override
            protected int getTextureLocationIndex(BlockChunkControl chunk, Vector3Int blockLocation, Block.Face face){
                if(chunk.isBlockOnSurface(blockLocation)){
                    switch(face){
                        case Top:
                            return 0;

                        case Bottom:
                            return 2;
                    }
                    return 1;
                }
                return 2;
            }
        });
        BlockManager.register(Block_Sand.class, new BlockSkin(new BlockSkin_TextureLocation(2, 1), false));
        BlockManager.register(Block_Stone.class, new BlockSkin(new BlockSkin_TextureLocation[]{
            new BlockSkin_TextureLocation(4, 1),
            new BlockSkin_TextureLocation(4, 1),
            new BlockSkin_TextureLocation(3, 1),
            new BlockSkin_TextureLocation(3, 1),
            new BlockSkin_TextureLocation(3, 1),
            new BlockSkin_TextureLocation(3, 1)
        }, false));
        BlockManager.register(Block_Lava.class, new BlockSkin(new BlockSkin_TextureLocation(5, 1), false));
        BlockManager.register(Block_Diamond.class, new BlockSkin(new BlockSkin_TextureLocation(6, 1), false));
        BlockManager.register(Block_Bedrock.class, new BlockSkin(new BlockSkin_TextureLocation(7, 1), false));
        BlockManager.register(Block_Glass.class, new BlockSkin(new BlockSkin_TextureLocation(8, 0), true));
        BlockManager.register(Block_WoodWindow.class, new BlockSkin(new BlockSkin_TextureLocation(8, 1), true));
        BlockManager.register(Block_Stonebrick.class, new BlockSkin(new BlockSkin_TextureLocation(9, 0), true));
        BlockManager.register(Block_Hopper.class, new BlockSkin(new BlockSkin_TextureLocation(9, 1), true));
        BlockManager.register(Block_Sandstone.class, new BlockSkin(new BlockSkin_TextureLocation[]{
            new BlockSkin_TextureLocation(0, 2),
            new BlockSkin_TextureLocation(0, 2),
            new BlockSkin_TextureLocation(1, 2),
            new BlockSkin_TextureLocation(1, 2),
            new BlockSkin_TextureLocation(1, 2),
            new BlockSkin_TextureLocation(1, 2)
        }, false));
        BlockManager.register(Block_Cactus.class, new BlockSkin(new BlockSkin_TextureLocation[]{
            new BlockSkin_TextureLocation(3, 2),
            new BlockSkin_TextureLocation(4, 2),
            new BlockSkin_TextureLocation(2, 2),
            new BlockSkin_TextureLocation(2, 2),
            new BlockSkin_TextureLocation(2, 2),
            new BlockSkin_TextureLocation(2, 2)
        }, false));
        BlockManager.register(Block_Melon.class, new BlockSkin(new BlockSkin_TextureLocation[]{
            new BlockSkin_TextureLocation(6, 2),
            new BlockSkin_TextureLocation(6, 2),
            new BlockSkin_TextureLocation(5, 2),
            new BlockSkin_TextureLocation(5, 2),
            new BlockSkin_TextureLocation(5, 2),
            new BlockSkin_TextureLocation(5, 2)
        }, false));
    }
}
